from allpairspy import AllPairs

from api_py.enums.cookie import Cookie
from api_py.generate_case.template import template_case
from api_py.utils.file_sys import write_json

cookies = [
    {"value": Cookie.ADMIN_COOKIE.value, "description": "管理员登录"},
    {"value": Cookie.SUPERVISOR_COOKIE.value, "description": "督导登录"},
    {"value": Cookie.COUNSELOR_COOKIE.value, "description": "咨询师登录"},
    {"value": Cookie.WEIXIN_COOKIE.value, "description": "微信访客登录"},
    {"value": Cookie.NULL_COOKIE.value, "description": "未登录"},
]


def case02_logout(api_type):
    json_result = {}
    i = 0

    for item in cookie:
        case = template_case()
        request = case["request"]

        # 设置请求头cookie
        request["headers"]["Cookie"] = item

        json_result[i] = case
        i = i + 1

    write_json(api_type.value[0]["file_name"], json_result)
